// login.ts

export interface LoginResponse {
  success: boolean;
  message?: string;
  data?: {
    username: string;
    access_token: string;
    refreshToken?: string;
    // 可扩展其他用户信息
  };
}
// 模拟API调用
export const login = async (
    username: string,
    password: string
): Promise<LoginResponse> => {
  return new Promise((resolve) => {
    setTimeout(() => {
      if (username === 'admin' && password === '1') {
        resolve({
          success: true,
          message: '登录成功',
          data: {
            username: 'admin',
            access_token: 'mock-access-token-123',
            refreshToken: 'mock-refresh-token-456'
          }
        });
      } else {
        resolve({ success: false, message: '用户名或密码错误' });
      }
    }, 500);
  });
};